// Copyright (C) 2020 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-object.seal
description: >
    Object.seal ArrayBuffer
info: |
  If Type(O) is not Object, return O.
  Let status be ? SetIntegrityLevel(O, sealed).

  SetIntegrityLevel ( O, level )

  Assert: Type(O) is Object.
  Assert: level is either sealed or frozen.
  Let status be ? O.[[PreventExtensions]]().
  If status is false, return false.
  Let keys be ? O.[[OwnPropertyKeys]]().
  If level is sealed, then
    For each element k of keys, do
  Else,
    Assert: level is frozen.
    For each element k of keys, do
      Let currentDesc be ? O.[[GetOwnProperty]](k).
      If currentDesc is not undefined, then
        If IsAccessorDescriptor(currentDesc) is true, then
        Else,
        Perform ? DefinePropertyOrThrow(O, k, desc).
  Return true.

---*/

function Test() {
    Object.seal(new ArrayBuffer());
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_TEST; i++) {
    Test();
}
